<?php

require_once '../include/common.inc.php';

if (!checkAdmin()) {
    header("LOCATION:index.php");
    exit;
}

$menu_index = 1;
$page_title = 'JANSEN';
$guide_message = 'Product | Basic Infomation | Add';
$code = (isset($_POST['code']) && $_POST['code'] != "Enter code ...") ? $_POST['code'] : "";
$inventory_ary = array();
$category_ary = array();

// All inventory
$sql = "SELECT `id`, `name`, `seq`, `type` FROM `inventory` ORDER BY `seq`";
$query = $db->query($sql);
while($rs = $db->fetch_array($query)) {
    $inventory_ary[] = $rs;
}
$inventory_ary_num = count($inventory_ary);

// All category
$sql = "SELECT `id`, `name`  FROM `category` WHERE `fid` = 0 ORDER BY `seq`";
$query = $db->query($sql);
while($rs = $db->fetch_array($query)) {
    $category_ary[] = $rs;
}
$category_ary_num = count($category_ary);

$sql = "SELECT `id`, `fid`, `name` FROM `category` WHERE `fid` > 0 ORDER BY `seq` ASC";
$query = $db->query($sql);
while($rs = $db->fetch_array($query)) {
    $sub_category_select_ary[$rs['fid']][$rs['id']] = $rs['name'];
}

require_once PrintEot('a_header');
require_once PrintEot('a_p_product_add');
require_once PrintEot('a_footer');

?>